package com.nulldev.util.networking.async2;

import java.util.Arrays;

public final class DataFrame {
	private final byte[] fBytes;
	private final int fLength;

	public DataFrame(final byte[] bytes) {
		this.fBytes = bytes;
		this.fLength = bytes.length;
	}

	public DataFrame(final byte[] bytes, final int offset, final int length) {
		this.fBytes = Arrays.copyOfRange(bytes, offset, length);
		this.fLength = this.fBytes.length;
	}

	public final byte[] getBytes() {
		return this.fBytes;
	}

	public final String asString() {
		return new String(this.fBytes);
	}

	public final int getLength() {
		return this.fLength;
	}
}
